/**
 * @file AllowSubscriptionHandler.cs
 * @author Zane Mayo
 * @date 26/5/2009
 */

using System;

namespace MxitAPI {
	
	
	public class AllowSubscriptionHandler : Handler {
		
		private static log4net.ILog log = log4net.LogManager.GetLogger( System.Reflection.MethodBase.GetCurrentMethod().DeclaringType );
		
		// Todo Remove later .. for debugging
		public string contactAddress;
		
		private int contactId;
		private string group;
		private string nickName;
		
		public AllowSubscriptionHandler() : base( typeof( AllowSubscriptionProtocolMessage ) )  {
			
		}
		
		public AllowSubscriptionHandler( int contactId, string group, string nickName) : this() {
			this.contactId = contactId;
			this.group = group;
			this.nickName = nickName;
		}

        public AllowSubscriptionHandler( string contactAddress, string group, string nickName ) : this() {
            this.contactAddress = contactAddress;
            this.group = group;
            this.nickName = nickName;
        }
		
		public override ProtocolMessage CreateRequestProtocolMessage() {
			
			
			AllowSubscriptionProtocolMessage protocolMessage = new AllowSubscriptionProtocolMessage();
			
			//protocolMessage.ContactAddress = Contacts.Instance.GetContact( contactId ).ContactAddress;
			// Todo Remove later .. for debugging
			protocolMessage.ContactAddress = contactAddress;
			protocolMessage.Group = group;
			protocolMessage.NickName = nickName;
			
			return protocolMessage;
		}
		
		protected override void HandleSpecificResponseProtocolMessage( ProtocolMessage protocolMessage ) {
			// Now that this user has been added, get the list of contacts so that the rest of their details can be retrieved
			// This doesnt seem needed, since the contact information is returned immidiately by mxit
			//( new GetContactsHandler() ).execute();
		}


		
	}
}